var img_url = mainlink+"?file=open.addpic&act=add&inputname=content&editor_btn=1&sysgroupid="+sysid;
var divw = 600; //弹出框宽度
var divh = 600; //弹出框高度
var allPlugin={
	Img:{c:'xheIcon xheBtnImg',t:'图片上传',h:1},
	Textnostyle:{c:'xheIcon xheBtnPastetext',t:'粘贴无格式文本',h:1,e:function(){
			var _this=this;
			var htmlCode='<div><div>使用键盘快捷键(Ctrl+V)，复制为无格式文本</div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
			var jCode=$(htmlCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
			jSave.click(function(){
				_this.loadBookmark();
				var sTxt = jValue.val();
				if(sTxt.length>0)
				{
					sArr = sTxt.split("\n");
					var sNum = sArr.length;
					for(i=0;i<sNum;i++)
					{
						if(sArr[i]=='' || sArr[i]=='&nbsp;' || sArr[i]==' ' || sArr[i]=='　')
						{
							_this.pasteHTML('<p><br /></p>');
						}
						else
						{
							_this.pasteHTML('<p>'+_this.domEncode(sArr[i])+'</p>');
						}
					}
				}
				_this.hidePanel();
				return false;	
			});
			_this.saveBookmark();
			_this.showDialog(jCode);
	}},
	phpok_img:{c:'xheIcon xheBtnUpImg',t:'服务器图片',e:function(){
		var _this = this;
		_this.showIframeModal('服务器图片',img_url,function(v){
			_this.loadBookmark();
			_this.pasteHTML(v);
		},divw,divh);
	}},
	phpok_left:{c:'xheIcon xheBtnLeft',t:'居左',e:function(){this.pasteHTML(this._exec('justifyleft'))}},
	phpok_center:{c:'xheIcon xheBtnCenter',t:'居中',e:function(){this.pasteHTML(this._exec('justifycenter'))}},
	phpok_right:{c:'xheIcon xheBtnRight',t:'居右',e:function(){this.pasteHTML(this._exec('justifyright'))}},
	paiban:{c:'xheIcon xheBtnRemoveformat',t:'一键排版',e:function(){
		var html = this.getSource();
		html = html.replace(/style="[^"]+"/ig,"");
		html = html.replace(/class="[^"]+"/ig,"");
		html = html.replace(/id="[^"]+"/ig,"");
		html = html.replace(/(<\/?a[^>]*>)(?!.*\1)/ig,"");
		html = html.replace(/<span><\/span>/ig,"");
		html = html.replace(/<p><\/p>/ig,"");
		html = html.replace(/<div><\/div>/ig,"");
		this.setSource(html);
	}}
};
var tools = {plugins:allPlugin,tools:'Source,Preview,Textnostyle,phpok_code,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,paiban,phpok_left,phpok_center,phpok_right,Outd ent,Link,Unlink,Anchor,Img,phpok_img,Hr,Emot,Table',height:400,loadCSS:'include/xheditor/xheditor_reset.css',shortcuts:{'ctrl+enter':submitForm},skin:'nostyle',cleanPaste:2,localUrlTest:/^[http|https]?:\/\/[^\/]*?(xxxxxxxxx\.com)\//i,remoteImgSaveUrl:'include/xheditor/saveremoteimg.php',upImgUrl:"include/xheditor/upload.php"};

function submitForm(){$('#qgform').submit();}